<!DOCTYPE html>
<html>
<head>
<title>管理员列表</title>
<#include "/header.html">
</head>
<body>
<div id="rrapp" v-cloak>
	<div v-show="showList">
    </div>
	
</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;用&nbsp;&nbsp;&nbsp;&nbsp;户&nbsp;&nbsp;&nbsp;&nbsp;名：<d id="username"></d></br><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;用&nbsp;户&nbsp;微&nbsp;信&nbsp;昵&nbsp;称:&nbsp;&nbsp;<input type="text" id="nickname" value=""></br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<button onclick="getNickname()">获取用户昵称信息</button></br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;输入用户昵称信息:<input type="text" id="nicknamestandard" value=""></br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;输入用户标识信息:<input type="text" id="openId" value=""></br>
<label>提示：</label> 
<textarea id="hint" name="DIVCSS5" cols="40" rows="6"> </textarea> <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;	<button onclick="bindWx()">绑定</button>
<script type="text/javascript">
	var user_id =  GetQueryString("user_id");
	var data = {"userId":user_id};
	function getUserInfo(){
		$.ajax({
			url : baseURL + "sys/user/info/"+user_id,
			type : 'POST',
			contentType : "application/json; charset=utf-8",
			//data : JSON.stringify(data),
			dataType : 'json',
			success : function(result) {
				if (result.user != null) {
					document.getElementById("username").innerHTML = result.user.username;
				} else {
					layer.msg("运维人员信息不存在", {
						icon : -1
					});
				}
			}
		});
	}
	getUserInfo();
	function getNickname(){
		var nickname = document.getElementById("nickname").value;
		//根据nickname获取用户OpenId
		$.ajax({
			url : baseURL + "operation/getInfoByNickName?nickname="+nickname,
			type : 'POST',
			contentType : "application/json; charset=utf-8",
			//data : JSON.stringify(data),
			dataType : 'json',
			success : function(result) {
				if (result.items != null) {
					for(var i=0;i<result.items.length;i++){
						var textHint = document.getElementById('hint');
						console.log(textHint);
						if(textHint!=null&&textHint!=''){
							textHint.value = textHint.value+'\n';
						}
			    		textHint.value=textHint.value+result.items[i].nickname+":";
			    		textHint.value = textHint.value+result.items[i].wxPublicOpenId;
					}
				} else {
					console.log(result);
					layer.msg("未拉取到用户信息", {
						icon : -1
					});
				}
			}
		});
	};
	
	function bindWx(){
		var openId = document.getElementById("openId").value;
		var nicknamestandard = document.getElementById("nicknamestandard").value;
		var bindData = {"userId":user_id,"wxPublicOpenId":openId,"nickname":nicknamestandard};
		$.ajax({
			url : baseURL + "sys/user/updateOnly",
			type : 'POST',
			contentType : "application/json; charset=utf-8",
			data : JSON.stringify(bindData),
			dataType : 'json',
			success : function(result) {
				if (result != null) {
					console.log(result);
				} else {
					console.log(result);
					layer.msg("未拉取到用户信息", {
						icon : -1
					});
				}
			}
		});
	}
	//已经借阅图书
	/* function bindWxHtml(id){
		vm.bindWxLayer(id);
	} */
</script>
</body>
</html>